package com.hzdh.account.utils;

import java.util.Calendar;
import java.util.Date;

public class GeneratorCodeUtils {

	public synchronized static String getSeqGeneratorCode(String str) {
		StringBuffer stringBuffer = new StringBuffer();
		Calendar calendar =  Calendar.getInstance();
		
		int year = calendar.get(Calendar.YEAR);
		int month = calendar.get(Calendar.MONTH) + 1;
		int day = calendar.get(Calendar.DATE);
		stringBuffer.append(str).append("-").append(year);
		if (month < 10) {
			stringBuffer.append("0" + month);
		} else {
			stringBuffer.append(month);
		}
		
		if (day < 10) {
			stringBuffer.append("-").append("00" + day);
		} else {
			stringBuffer.append("-").append("0" + day);
		}
		
		return stringBuffer.toString();
	}

	public static void main(String[] args) {
		for (int i = 0; i < 10; i++) {
			
			System.out.println(getSeqGeneratorCode("PAY"));
		}
	}

}
